package Test;

import android.test.ActivityInstrumentationTestCase2;
import android.test.MainActivity;
import android.test.R;
import android.test.R.id;
import android.widget.Button;

public class MainActivityTesting extends
		ActivityInstrumentationTestCase2<MainActivity> {
	private MainActivity mActivity;
	private Button mLoginButton;
	private Button mGameListButton;
	private Button mMapOverviewButton;
	private Button mTeamOverviewActivity;
	public MainActivityTesting(Class<MainActivity> activityClass) {
		super(activityClass);
		
	}
	@Override
	protected void setUp() throws Exception {
		super.setUp();
		setActivityInitialTouchMode(false);
		mActivity = getActivity();
		mLoginButton =  (Button)mActivity.findViewById(android.test.R.id.LoginViewButton);
		mGameListButton =  (Button)mActivity.findViewById(android.test.R.id.GameListButton);
		mMapOverviewButton =  (Button)mActivity.findViewById(android.test.R.id.MapOverviewButton);
		mTeamOverviewActivity =  (Button)mActivity.findViewById(android.test.R.id.TeamViewButton);
		
	}
	public void TestButtons(){
		mActivity.runOnUiThread(
				new Runnable(){
					public void run(){
						mLoginButton.requestFocus();
						mGameListButton.requestFocus();
						mMapOverviewButton.requestFocus();
						mTeamOverviewActivity.requestFocus();
					}
				});
		assertTrue(mLoginButton.callOnClick());
		assertTrue(mGameListButton.callOnClick());
		assertTrue(mMapOverviewButton.callOnClick());
		assertTrue(mTeamOverviewActivity.callOnClick());
		
	}

}
